﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WarstwaDanych;
using Udostepnianie_plikow.ViewModels;
using System.Configuration;

namespace Udostepnianie_plikow.Controllers
{
    public class FileController : Controller
    {
        //
        // GET: /File/

        

        public ActionResult Index()
        {
          // ASPNETDBEntities baza = new ASPNETDBEntities();
            WarstwaDanych.Model1Container baza = new Model1Container(ConfigurationManager.ConnectionStrings["Model1Container"].ConnectionString);
            var resultViewModel = baza.Pliki
               // .Where( p=> p.Uprawnienia_do_pliku.aspnet_Users.UserName == User.Identity.Name)
                .Select(p => new FileViewModel() { Name = p.Sciezka, Path = p.Sciezka, Size = 0 }).ToList();


            return View(resultViewModel);
        }

    }
}
